Class Metrics
- java.lang.Object
-
- page.codeberg.terratactician_expandoria.world.Metrics
-
public class Metrics extends java.lang.ObjectMetrics aka Resources. This class will be used for multiple metrics values relevant to the game.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Metricsclone()static Metricsdeserialize(org.json.JSONObject data)deserializes metrics from a json object.doublegetFood()get food component.doublegetMaterials()get materials component.doublegetMoney()get money componentbooleanisSmallerEqThen(Metrics other)Check is the metrics are smaller or equal than another metrics object.org.json.JSONObjectserialize()serializes Metrics to jsonjava.lang.StringtoString()
-
-
-
Constructor Detail
-
Metrics
public Metrics()
Create empty metrics object.
-
Metrics
public Metrics(Metrics other)
Copy the metrics- Parameters:
other- metrics to copy
-
-
Method Detail
-
deserialize
public static Metrics deserialize(org.json.JSONObject data)
deserializes metrics from a json object.- Parameters:
data- json data- Returns:
- deserialized metrics
-
serialize
public org.json.JSONObject serialize()
serializes Metrics to json- Returns:
- json object
-
getFood
public double getFood()
get food component.- Returns:
- amount
-
getMaterials
public double getMaterials()
get materials component.- Returns:
- amount
-
getMoney
public double getMoney()
get money component- Returns:
- amount
-
isSmallerEqThen
public boolean isSmallerEqThen(Metrics other)
Check is the metrics are smaller or equal than another metrics object.- Parameters:
other- to compare to- Returns:
- if is smaller/equal
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
clone
public Metrics clone()
- Overrides:
clonein classjava.lang.Object
-
-